<?php

include($GLOBALS['LNG'].$_SESSION[$SESSLG]."/main.settings.php");
include($GLOBALS['LNG'].$_SESSION[$SESSLG]."/mod.clients.php");

require_once($_SERVER['DOCUMENT_ROOT'].'/defaultconf.mex');

MYTCONN();

$user = $GLOBALS['MYT']->db_array("SELECT name, staffmember FROM systemoffice.main_users where ref = {$_SESSION[$SESSID]} ");

$staff_member = $user[1]['staffmember'];

//echo $staff_member;

$userMail = $GLOBALS['MYT']->db_array("SELECT * FROM systemoffice.staff_members where smb_ID = '{$staff_member}' ");
$userMail2 = $userMail[1]['smb_CttEmail'];

//echo $userMail2;

$loja = $GLOBALS['MYT']->db_array("SELECT name FROM systemoffice.main_offices where ref = {$_SESSION[$SESSOF]} ");

$data = date("Y-m-d H:i:s");
$estado = "Aberto";
$user2 = $user[1]['name'];
$loja2 = $loja[1]['name'];
$atribuido_a = "A atribuir";
$data_res = $data;
$prioridade = "A atribuir";


	$to = "<it@moneyexpress.pt>,<cris.ruiz@moneyexpress.pt>,<$userMail2>";
	$subj = $loja[1]['name']." - ".$user[1]['name'];
	$motive = $_POST['mensagem'];
	$toName = 'uu8t6t';

	$mess = "$motive \r\n ";
	$AttmFiles = '';
	$From = '<no-reply@moneyexpress.pt>';
	$FromName = 'Report de Erros Lojas'.Empresa::getNome();

	$Html = '';
	authmail($From,$FromName,$to,$toName,$subj,$mess,$Html,$AttmFiles,$_sysconfMailString);

	$inserir_prob_it = ("INSERT INTO systemoffice.it_requests
							(main_users_ref, main_office_ref, data, problema, data_reso, user_mail)
					values
							('$user2', '$loja2', '$data', '$motive', '$data_res', '$userMail2') ");

	$inserir_prob = $GLOBALS['MYT']->db_query($inserir_prob_it);

echo "Report Enviado. Aguarde Resolução.";
?>